set.seed(2024)
<- 50
n <- 0.4
p <- p*(1-p)/n
sigma2
<- rnorm(10000,p,sqrt(sigma2))
p1
<- function(x){log(x/(1-x))}
logit_trans <- function(x){exp(x)/(1+exp(x))}
inverse_logit
<- logit_trans(p1)
logit_p1
<- logit_trans(p)
logit_p_mean <- sd(logit_p1)
logit_p_sd
<- c((logit_p_mean+qnorm(0.025)*logit_p_sd),
logCI
logit_p_mean,+qnorm(0.975)*logit_p_sd)
(logit_p_mean
)
<- inverse_logit(logCI)
CI CI
[1] 0.2716469 0.4000000 0.5437262